﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewsProperty.ascx.cs" Inherits="NLUNZ.UserControls.NewsProperty" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!--
Display editable news list with paging enabled

-->

<div>
    <div class="newsEditHeader">
                <div id="insertPartnerTab" class="tablinnerContainer">
            新闻编辑
            </div>
                <div class="tabrefreshContainer">
        <asp:ImageButton ID="ImageButton3" runat="server"  onclick="LinkButton1_Click" 
            ImageUrl="~/Admin/Contents/Images/refresh.fw.png" />
        
    </div>
    </div>
    <div id="newsDetailsEditView" style="float:left; width:100%;">
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
            DataSourceID="LinqDataSourceDetailsEdit" EnableModelValidation="True">
            <EditItemTemplate>
                <b>Title:</b>
                <asp:TextBox ID="TitleTextBox" runat="server" CssClass="newsTitleTxt"  Text='<%# Bind("Title") %>' />
                <br />
                <b>Content:</b>
                <br/>
                <telerik:RadEditor ID="RadEditor2" runat="server" 
                    Content='<%# Bind("Content") %>'>
                     <ImageManager ViewPaths="~/StyleLibrary/Images" UploadPaths="~/StyleLibrary/Images" DeletePaths="~/StyleLibrary/Images"></ImageManager>
                <MediaManager ViewPaths="~/StyleLibrary/Media" UploadPaths="~/StyleLibrary/Media" DeletePaths="~/StyleLibrary/Media"></MediaManager>
                <DocumentManager ViewPaths="~/StyleLibrary/Documents" UploadPaths="~/StyleLibrary/Documents" DeletePaths="~/StyleLibrary/Documents"></DocumentManager>
            
                </telerik:RadEditor>
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"  CssClass="admin-button" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel"  Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>

                <b>Title:</b>
                <asp:TextBox ID="TitleTextBox" runat="server" CssClass="newsTitleTxt" Text='<%# Bind("Title") %>' />
                <br />
                <b>Content:</b><br/><br/><telerik:RadEditor ID="RadEditor1" runat="server" Skin="Sitefinity" Content='<%#Bind("Content") %>'>
                                              <ImageManager ViewPaths="~/StyleLibrary/Images" UploadPaths="~/StyleLibrary/Images" DeletePaths="~/StyleLibrary/Images"></ImageManager>
                <MediaManager ViewPaths="~/StyleLibrary/Media" UploadPaths="~/StyleLibrary/Media" DeletePaths="~/StyleLibrary/Media"></MediaManager>
                <DocumentManager ViewPaths="~/StyleLibrary/Documents" UploadPaths="~/StyleLibrary/Documents" DeletePaths="~/StyleLibrary/Documents"></DocumentManager>
            
                </telerik:RadEditor>
                <br />
                <asp:LinkButton ID="InsertButton" runat="server"  CausesValidation="True" 
                    CommandName="Insert"  CssClass="admin-button"  Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel"  CssClass="admin-button"  Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"  CssClass="admin-button" 
                    CommandName="Edit" Text="Edit" />
                &nbsp;<asp:LinkButton ID="NewButton"  CssClass="admin-button" runat="server" CausesValidation="False" 
                                      CommandName="New" Text="New" /> <br/>
                <b>Title:</b>
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
                <br />
                <b>Content:</b> <br/><br/>
                <asp:Label ID="ContentLabel" CssClass="newsContent" runat="server" Text='<%# Bind("Content") %>' />
                <br />
            </ItemTemplate>
        </asp:FormView>


        <asp:LinqDataSource ID="LinqDataSourceDetailsEdit" 
            ContextTypeName="NLUNZ.Business.NLUDBDataContext" TableName="CompanyInfos" 
            runat="server" EnableInsert="True" EnableUpdate="True" Where="ID == @ID" 
            onselecting="LinqDataSourceDetailsEdit_Selecting">
            <WhereParameters>
                <asp:ControlParameter ControlID="GridViewNewsList" Name="ID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>
    </div>
    <div id="newsListViewtab" style="float:left;width:100%;">
    <asp:GridView ID="GridViewNewsList" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="4" ShowHeader="False"
        DataSourceID="LinqDataSourceCompanyInfo" EnableModelValidation="True" 
        ForeColor="#333333" GridLines="None" DataKeyNames="ID" Width="100%" >
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ShowSelectButton="True" SelectText="View Details" >
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
            </asp:CommandField>
            <asp:BoundField DataField="ID" Visible="False" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title">
            <ItemStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField DataField="CreateDate" DataFormatString="{0:yyyy-MM-dd}" 
                HeaderText="CreateDate" SortExpression="CreateDate">
            <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/delete-icon.gif" 
                ShowDeleteButton="True">
            <ItemStyle HorizontalAlign="Center" Width="25px" />
            </asp:CommandField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <EmptyDataTemplate>
            No News!
        </EmptyDataTemplate>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" Height="32px" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSourceCompanyInfo" 
        ContextTypeName="NLUNZ.Business.NLUDBDataContext" TableName="CompanyInfos" 
        runat="server" EnableDelete="True" OrderBy="CreateDate desc">
        
    </asp:LinqDataSource>
    </div>
</div>